ACTIVE_USER_ANALYSIS_CONFIG = {
    'real_time_report': False,
    'group_by': '_user_id',
    'interval_type_list': ['day'],
    'target_event_id': ['recharge', 'withdraw', 'cp_game', 'cp_lottery', 'platform_reward'],
    'values': [
        {
            "value_id": "active_days",
            "target_value": "_account_active_days",
            "value_name": "投注天数",
            "filter": [
                {"terms": {"_event_id": ['cp_game', 'cp_lottery']}}
            ],
            "operation": "cardinality",
            "value_type": "long"
        },
        {
            "value_id": "recharge_count",
            "target_value": "recharge_price",
            "value_name": "累计充值次数",
            "filter": [
                {'terms': {'_event_id': ['recharge']}},
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "recharge",
            "target_value": "recharge_price",
            "value_name": "累计充值金额",
            "filter": [
                {'terms': {'_event_id': ['recharge']}},
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "withdraw_count",
            "target_value": "withdraw_real_price",
            "value_name": "累计提现次数",
            "filter": [
                {'term': {'_event_id': 'withdraw'}},
                {'term': {'withdraw_status': 2}}
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "withdraw",
            "target_value": "withdraw_real_price",
            "value_name": "累计提现金额",
            "filter": [
                {'term': {'_event_id': 'withdraw'}},
                {'term': {'withdraw_status': 2}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "real_profit",
            "target_value": ['withdraw_real_price', '-', 'recharge_price'],
            "value_name": "实际盈利",
            "filter": [
                {'terms': {'_event_id': ['withdraw', 'recharge']}},
            ],
            "not_filter": [
                {'term': {'withdraw_status': 4}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "lottery_bet",
            "target_value": "cp_lottery_price",
            "value_name": "有效购彩",
            "filter": [
                {'term': {'_event_id': 'cp_lottery'}},
                {'term': {'cp_lottery_refund': 0}},
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "lottery_win",
            "target_value": ['cp_lottery_win', '+', 'cp_lottery_bonus'],
            "value_name": "购彩中獎",
            "filter": [
                {'term': {'_event_id': 'cp_lottery'}},
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "lottery_profit",
            "target_value": 'cp_lottery_profit',
            "value_name": "购彩盈利",
            "filter": [
                {'term': {'_event_id': 'cp_lottery'}},
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "game_bet",
            "target_value": "cp_game_price",
            "value_name": "电玩城参与",
            "filter": [
                {'term': {'_event_id': 'cp_game'}},
                {'term': {'cp_game_sub_type': 'game'}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "game_profit",
            "target_value": 'cp_game_profit',
            "value_name": "电玩城盈利",
            "filter": [
                {'term': {'_event_id': 'cp_game'}},
                {'term': {'cp_game_sub_type': 'game'}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "metis_bet",
            "target_value": "cp_game_price",
            "value_name": "metis参与",
            "filter": [
                {'term': {'_event_id': 'cp_game'}},
                {'term': {'cp_game_sub_type': 'metis'}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "metis_profit",
            "target_value": 'cp_game_profit',
            "value_name": "metis盈利",
            "filter": [
                {'term': {'_event_id': 'cp_game'}},
                {'term': {'cp_game_sub_type': 'metis'}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "platform_reward",
            "target_value": "platform_reward_reward_amount",
            "value_name": "系统奖励",
            "filter": [
                {'term': {'_event_id': 'platform_reward'}},
            ],
            "not_filter": [
                {'term': {'platform_reward_sub_type': 'agent'}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "agent_reward",
            "target_value": "platform_reward_reward_amount",
            "value_name": "代理奖励",
            "filter": [
                {'term': {'_event_id': 'platform_reward'}},
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "total_bet",
            "target_value": ['cp_game_price', '+', 'cp_lottery_price'],
            "value_name": "累计投注金额",
            "filter": [
                {'terms': {'_event_id': ['cp_game', 'cp_lottery']}},
            ],
            "not_filter": [
                {'range': {'cp_lottery_refund': {'gt': 0}}}
            ],
            "value_type": "float",
            "adjust_amount": True
        },
        {
            "value_id": "_total_profit",
            "target_value": ['cp_game_profit', '+', 'cp_lottery_profit'],
            "value_name": "累计盈利",
            "filter": [
                {'terms': {'_event_id': ['cp_game', 'cp_lottery']}},
            ],
            "value_type": "float",
            "adjust_amount": True
        }
    ]
}
